package org.example.ssm.gof;

/**
 * @author 莫磊
 * @date 2025/8/16
 * @description 建造者模式
 */
public class BuilderGoF {

    private String name;

    private Integer age;

    private BuilderGoF() {
    }

    public static BuilderGoFBuilder builder() {
        return new BuilderGoFBuilder();
    }

    public static class BuilderGoFBuilder{
        private String name;
        private Integer age;

        public BuilderGoFBuilder name(String name) {
            this.name = name;
            return this;
        }

        public BuilderGoFBuilder age(Integer age) {
            this.age = age;
            return this;
        }

        public BuilderGoF build() {
            BuilderGoF builderGoF = new BuilderGoF();
            builderGoF.name = name;
            builderGoF.age = age;
            return builderGoF;
        }
    }
}
